<%-- 
    Document   : temp
    Created on : Oct 11, 2013, 10:09:53 AM
    Author     : NGUYEN
--%>

<%@page import="DTO.SANPHAMDTO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="DAO.SANPHAMDAO"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>DanhSachSanPham</title>
        <script language="javascript" type="text/javascript">
            function showMenu(isShow, idSubMenu)
            {
                var subMenu = document.getElementById(idSubMenu);
                if (isShow == true)
                    subMenu.style.visibility = "visible"
                else
                    subMenu.style.visibility = "hidden"
            }
        </script>
        <style type="text/css">
            .menu
            {
                position:absolute;
                visibility:hidden;
            }


        </style>
    </head>


    <body>
        <table width="800" border="1" align="center">
            <!--header-->
            <jsp:include page="header.jsp"/>
            <!--header end-->

            <!--menu-->
            <jsp:include page="menu.jsp"/>
            <!--menu end-->

            <!--body-->
            <tr>

                <td height="404" align="center" valign="top"><p><b>DANH SÁCH SẢN PHẨM   </b></p>
                    <form id="form1" name="form1" method="post" action="timsanpham">
                        <label>
                            <input name="btTimSP" type="submit" id="btTimSP" value="Tìm Kiếm" />
                        </label>
                        <p>
                            <label>
                                <select name="select">
                                    <option value="1">Tìm Theo Mã</option>
                                    <option value="2">Tìm Theo Tên</option>
                                    <option value="3">Tìm Theo Loại</option>
                                </select>
                            </label>
                            <label>
                                <input name="tfTimSP" type="text" id="tfTimSP" />
                            </label>
                        </p>
                    </form>      
                    <table width="90%" border="1" align="center">
                        <tr>
                            <td width="10%" align="center" bgcolor="#99CC00">Mã SP </td>
                            <td width="15%" align="center" bgcolor="#99CC00">Tên Sản Phẩm </td>
                            <td width="15%" align="center" bgcolor="#99CC00">Đơn giá </td>
                            <td width="15%" align="center" bgcolor="#99CC00">Loại Sản Phẩm </td>
                            <td width="15%" align="center" bgcolor="#99CC00">Số Lượng </td>
                            <td width="20%" align="center" bgcolor="#99CC00">Tình Trang </td>
                        </tr>

                        <!--Bat dau vong lap for(i=0;i<so dong;i++):de cho ra so dong cua Table-->
                        <%
                            
                            ArrayList<SANPHAMDTO> ds = new ArrayList<SANPHAMDTO>();
                         
                            ds = (ArrayList<SANPHAMDTO>)request.getAttribute("danhsach");
                         
                            if (ds.isEmpty()) {
                        %>
                        <tr>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>

                        <%                } else {
                            for (int i = 0; i < ds.size(); i++) {
                                int masp = ds.get(i).getMasp();
                                String tensp = ds.get(i).getTensp();
                                int dongia = ds.get(i).getDongia();
                                int maloai = ds.get(i).getMaloai();
                                int soluong = ds.get(i).getSoluong();
                                String tinhtrang = ds.get(i).getTinhtrang();


                        %>
                        </tr>
                        <tr>
                            <td><a href="laysanphamcoma?ma=<%=masp%>"><%=masp%></td>
                            <td><%=tensp%></td>
                            <td><%=dongia%></td>
                            <td><%=maloai%></td>
                            <td><%=soluong%></td>
                            <td><%=tinhtrang%></td>
                        </tr>
                        <%
                                }

                            }
                        %>
                        <!--Ket thuc vong lap for()-->


                    </table>      
                    <form id="form3" name="form3" method="post" action="themsanpham.jsp">
                        <label>
                            <input name="btThemSP" type="submit" id="btThemSP" value="Thêm" style="width:70px"/>
                        </label>
                    </form>      <p>&nbsp; </p></td>
            </tr>

            <!--body end-->
            <!--footer-->
            <jsp:include page="footer.jsp"/>
            <!--footer end-->
        </table>
    </body>
</html>


